#include "Globe.h"
ValMgr* RootValMgr;
ValMgr* CurrentValMgr;
FuncMgr* CurrentFuncMgr;

map<string, FuncMgr>function_codes;

void Global_Module_Initialize()
{
    RootValMgr = new ValMgr(ValMgr::GLOBAL, nullptr);
    CurrentValMgr = RootValMgr;
}

void Global_Module_Unload()
{
    delete RootValMgr;
    RootValMgr = nullptr;
    CurrentValMgr = nullptr;
}

bool Function_Analyze_Initialize(string name)
{
    if (function_codes.count(name))return false;
    function_codes[name] = FuncMgr();
    function_codes[name].func_val_mgr = new ValMgr(ValMgr::FUNCTION, RootValMgr);
    CurrentFuncMgr = &function_codes[name];
    CurrentValMgr = function_codes[name].func_val_mgr;
    return true;
}
